﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.PrimanjeTip"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class PrimanjeTipEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ID property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxID;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ID property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDLabel;
		
		/// <summary>
		/// TextBox for the Naziv property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxNaziv;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Naziv property.
		/// </summary>
		protected System.Windows.Forms.Label uxNazivLabel;
		
		/// <summary>
		/// TextBox for the Postotak property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxPostotak;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the Postotak property.
		/// </summary>
		protected System.Windows.Forms.Label uxPostotakLabel;
		
		/// <summary>
		/// ComboBox for the OsnovaOsiguranja property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxOsnovaOsiguranja;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the OsnovaOsiguranja property.
		/// </summary>
		protected System.Windows.Forms.Label uxOsnovaOsiguranjaLabel;
		
		/// <summary>
		/// ComboBox for the VrstaRada property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxVrstaRada;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the VrstaRada property.
		/// </summary>
		protected System.Windows.Forms.Label uxVrstaRadaLabel;
		
		/// <summary>
		/// ComboBox for the IndikatorID property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIndikatorID;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IndikatorID property.
		/// </summary>
		protected System.Windows.Forms.Label uxIndikatorIDLabel;
		
		/// <summary>
		/// ComboBox for the IDVrstaRaspodjele property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxIDVrstaRaspodjele;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the IDVrstaRaspodjele property.
		/// </summary>
		protected System.Windows.Forms.Label uxIDVrstaRaspodjeleLabel;
		#endregion
		
		#region Main entity
		private Entities.PrimanjeTip _PrimanjeTip;
		/// <summary>
		/// Gets or sets the <see cref="Entities.PrimanjeTip"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.PrimanjeTip"/> instance.</value>
		public Entities.PrimanjeTip PrimanjeTip
		{
			get {return this._PrimanjeTip;}
			set
			{
				this._PrimanjeTip = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxID.DataBindings.Clear();
			this.uxID.DataBindings.Add("Text", this.uxBindingSource, "ID", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxNaziv.DataBindings.Clear();
			this.uxNaziv.DataBindings.Add("Text", this.uxBindingSource, "Naziv", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxPostotak.DataBindings.Clear();
			this.uxPostotak.DataBindings.Add("Text", this.uxBindingSource, "Postotak", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxOsnovaOsiguranja.DataBindings.Clear();
			this.uxOsnovaOsiguranja.DataBindings.Add("SelectedValue", this.uxBindingSource, "OsnovaOsiguranja", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxVrstaRada.DataBindings.Clear();
			this.uxVrstaRada.DataBindings.Add("SelectedValue", this.uxBindingSource, "VrstaRada", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIndikatorID.DataBindings.Clear();
			this.uxIndikatorID.DataBindings.Add("SelectedValue", this.uxBindingSource, "IndikatorID", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxIDVrstaRaspodjele.DataBindings.Clear();
			this.uxIDVrstaRaspodjele.DataBindings.Add("SelectedValue", this.uxBindingSource, "IDVrstaRaspodjele", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="PrimanjeTipEditControlBase"/> class.
		/// </summary>
		public PrimanjeTipEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_PrimanjeTip != null) _PrimanjeTip.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxID = new System.Windows.Forms.TextBox();
			uxIDLabel = new System.Windows.Forms.Label();
			this.uxNaziv = new System.Windows.Forms.TextBox();
			uxNazivLabel = new System.Windows.Forms.Label();
			this.uxPostotak = new System.Windows.Forms.TextBox();
			uxPostotakLabel = new System.Windows.Forms.Label();
			this.uxOsnovaOsiguranja = new System.Windows.Forms.ComboBox();
			uxOsnovaOsiguranjaLabel = new System.Windows.Forms.Label();
			this.uxVrstaRada = new System.Windows.Forms.ComboBox();
			uxVrstaRadaLabel = new System.Windows.Forms.Label();
			this.uxIndikatorID = new System.Windows.Forms.ComboBox();
			uxIndikatorIDLabel = new System.Windows.Forms.Label();
			this.uxIDVrstaRaspodjele = new System.Windows.Forms.ComboBox();
			uxIDVrstaRaspodjeleLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxIDLabel
			//
			this.uxIDLabel.Text = "ID:";
			this.uxIDLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxIDLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDLabel);			
			//
			// uxID
			//
			this.uxID.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxID);
			this.uxID.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxID);
			//
			// uxNazivLabel
			//
			this.uxNazivLabel.Text = "Naziv:";
			this.uxNazivLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxNazivLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxNazivLabel);			
			//
			// uxNaziv
			//
			this.uxNaziv.Width = 250;
			this.uxNaziv.MaxLength = 100;
			//this.uxTableLayoutPanel.Controls.Add(this.uxNaziv);
			this.uxNaziv.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxNaziv);
			//
			// uxPostotakLabel
			//
			this.uxPostotakLabel.Text = "Postotak:";
			this.uxPostotakLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxPostotakLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxPostotakLabel);			
			//
			// uxPostotak
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxPostotak);
			this.uxPostotak.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxPostotak);
			//
			// uxOsnovaOsiguranjaLabel
			//
			this.uxOsnovaOsiguranjaLabel.Text = "OsnovaOsiguranja:";
			this.uxOsnovaOsiguranjaLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxOsnovaOsiguranjaLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxOsnovaOsiguranjaLabel);			
			//
			// uxOsnovaOsiguranja
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxOsnovaOsiguranja);
			this.uxOsnovaOsiguranja.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxOsnovaOsiguranja);
			//
			// uxVrstaRadaLabel
			//
			this.uxVrstaRadaLabel.Text = "VrstaRada:";
			this.uxVrstaRadaLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxVrstaRadaLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxVrstaRadaLabel);			
			//
			// uxVrstaRada
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxVrstaRada);
			this.uxVrstaRada.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxVrstaRada);
			//
			// uxIndikatorIDLabel
			//
			this.uxIndikatorIDLabel.Text = "IndikatorID:";
			this.uxIndikatorIDLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxIndikatorIDLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIndikatorIDLabel);			
			//
			// uxIndikatorID
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIndikatorID);
			this.uxIndikatorID.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxIndikatorID);
			//
			// uxIDVrstaRaspodjeleLabel
			//
			this.uxIDVrstaRaspodjeleLabel.Text = "IDVrstaRaspodjele:";
			this.uxIDVrstaRaspodjeleLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxIDVrstaRaspodjeleLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDVrstaRaspodjeleLabel);			
			//
			// uxIDVrstaRaspodjele
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxIDVrstaRaspodjele);
			this.uxIDVrstaRaspodjele.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxIDVrstaRaspodjele);
			//
			// uxIndikatorID
			//				
			this.uxIndikatorID.DisplayMember = "IDSifarnikTip";	
			this.uxIndikatorID.ValueMember = "ID";	
			//
			// uxVrstaRada
			//				
			this.uxVrstaRada.DisplayMember = "IDSifarnikTip";	
			this.uxVrstaRada.ValueMember = "ID";	
			//
			// uxOsnovaOsiguranja
			//				
			this.uxOsnovaOsiguranja.DisplayMember = "IDSifarnikTip";	
			this.uxOsnovaOsiguranja.ValueMember = "ID";	
			//
			// uxIDVrstaRaspodjele
			//				
			this.uxIDVrstaRaspodjele.DisplayMember = "Naziv";	
			this.uxIDVrstaRaspodjele.ValueMember = "ID";	
			// 
			// PrimanjeTipEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "PrimanjeTipEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.Sifarnik> _IndikatorIDList;
		
		/// <summary>
		/// The ComboBox associated with the IndikatorID property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Sifarnik> IndikatorIDList
		{
			get {return _IndikatorIDList;}
			set 
			{
				this._IndikatorIDList = value;
				this.uxIndikatorID.DataSource = null;
				this.uxIndikatorID.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIndikatorIDList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IndikatorID property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIndikatorIDList
		{
			get { return _allowNewItemInIndikatorIDList;}
			set
			{
				this._allowNewItemInIndikatorIDList = value;
				this.uxIndikatorID.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.Sifarnik> _VrstaRadaList;
		
		/// <summary>
		/// The ComboBox associated with the VrstaRada property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Sifarnik> VrstaRadaList
		{
			get {return _VrstaRadaList;}
			set 
			{
				this._VrstaRadaList = value;
				this.uxVrstaRada.DataSource = null;
				this.uxVrstaRada.DataSource = value;
			}
		}
		
		private bool _allowNewItemInVrstaRadaList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the VrstaRada property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInVrstaRadaList
		{
			get { return _allowNewItemInVrstaRadaList;}
			set
			{
				this._allowNewItemInVrstaRadaList = value;
				this.uxVrstaRada.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.Sifarnik> _OsnovaOsiguranjaList;
		
		/// <summary>
		/// The ComboBox associated with the OsnovaOsiguranja property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.Sifarnik> OsnovaOsiguranjaList
		{
			get {return _OsnovaOsiguranjaList;}
			set 
			{
				this._OsnovaOsiguranjaList = value;
				this.uxOsnovaOsiguranja.DataSource = null;
				this.uxOsnovaOsiguranja.DataSource = value;
			}
		}
		
		private bool _allowNewItemInOsnovaOsiguranjaList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the OsnovaOsiguranja property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInOsnovaOsiguranjaList
		{
			get { return _allowNewItemInOsnovaOsiguranjaList;}
			set
			{
				this._allowNewItemInOsnovaOsiguranjaList = value;
				this.uxOsnovaOsiguranja.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.VrstaRaspodjele> _IDVrstaRaspodjeleList;
		
		/// <summary>
		/// The ComboBox associated with the IDVrstaRaspodjele property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.VrstaRaspodjele> IDVrstaRaspodjeleList
		{
			get {return _IDVrstaRaspodjeleList;}
			set 
			{
				this._IDVrstaRaspodjeleList = value;
				this.uxIDVrstaRaspodjele.DataSource = null;
				this.uxIDVrstaRaspodjele.DataSource = value;
			}
		}
		
		private bool _allowNewItemInIDVrstaRaspodjeleList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the IDVrstaRaspodjele property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDVrstaRaspodjeleList
		{
			get { return _allowNewItemInIDVrstaRaspodjeleList;}
			set
			{
				this._allowNewItemInIDVrstaRaspodjeleList = value;
				this.uxIDVrstaRaspodjele.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
